<?php
/* 联系记录,与客人的多次联系日志 情况跟踪记录管理 
 */

class Contact_recordAction extends CommonAction {
    //TODO
    function _filter(&$map) {
        if(!empty($_REQUEST['keywords']) ){
            $key = trim($_REQUEST['keywords']);
            $member_id = M('Member')->where("name like '%".$key."%'")->field('id')->findAll();
             $houses = array();
             foreach ($member_id as $k => $value) {
                 $houses[$k] = $value['id'];
             }
             $member_id = implode(",", $houses);
             if(!empty($member_id)) {
                 $where['member_id'] = array('in',$member_id);
             }
            $where['content'] = array('like',"%".$key."%");
            $where['_logic'] = "or";
            $map['_complex'] = $where;
        }
        if(!empty($_REQUEST['member_id']) ){
            $map['member_id'] = $_REQUEST['member_id'];
        }

    }

}
?>
